#ifndef _CCSPINESPRITE_H_
#define _CCSPINESPRITE_H_

#include "cocos2d.h"
USING_NS_CC;


#ifndef RENDER_IN_SUBPIXEL
#define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
#endif

class CCSkeletalSprite;

class CCSpineSprite : public Sprite {
public:
	~CCSpineSprite();
	static CCSpineSprite* create();
	static CCSpineSprite* createWithSpriteFrame(SpriteFrame* pSpriteFrame);
    
	virtual void updateTransform();
    
	void setTranformToBatch(const AffineTransform& transform);
    
    virtual AffineTransform nodeToParentTransform() {
        return _transformToBatch;
    }
    
    void setPercentage(float p);

    void setColor(const Color4B& c4);
    void setFlipX(bool isFlipx) {
        _isFlipX=isFlipx;
    }
    
    void debug();

protected:
	CCSpineSprite();
    
    bool _isFlipX;
    
    /* -------for hp ...unit only----  */
    
    Tex2F* _orgTextureCoord;
    Vertex3F* _orgVertex;
    
    float _percentage;
    
    bool _barDirty;
    
private:
    
    Tex2F textureCoordFromAlphaPoint(Point alpha);
    
    Vertex3F vertexFromAlphaPoint(Point alpha);
    
    void updateBar();
    
    /* -------for hp ...unit only----  */
    
};



#endif